import { reqCategoryList } from "@/api"
import { getbanner, getFloor } from "@/api/mock"

export default {
  namespaced:true,
  state() {
    return {
      categoryList:[],
      bannerList:[],
      floorList:[],
    }
  },
  mutations: {
    setcategoryList(state,categoryList){
      state.categoryList=categoryList
    },
    setBannerList(state,bannerList){
      state.bannerList=bannerList
    },
    setFloorList(state,floorList){
      state.floorList=floorList.data
    }
  },
  actions: {
    // 获取分类列表
    async getcategoryList(context){
      let result=await reqCategoryList()
      context.commit('setcategoryList',result.data)
    },
    // 获取广告轮播图
    async getBannerList({commit}){
      const result=await getbanner()
      commit('setBannerList',result)
    },
    // 获取Floor
    async getFloorList({commit}){
      const result=await getFloor()
      commit('setFloorList',result)
    }

  }
}